<form class="form-horizontal" ng-submit="do_attach()">
    <div class="modal-header">
        <a class="close" ng-click="close()">×</a>

        <h5>请选择一个您要关联的虚拟机</h5>
    </div>
    <div class="modal-body">
        <div class="row-fluid" style="padding-bottom: 5px">

            <div class="span4 offset8">
                <span>每页显示</span>
                <select class="input-mini" ng-model="page_size" ng-options="pz for pz in page_sizes"
                        ng-change="change(page_size)">
                </select>
                <span>条</span>
            </div>

        </div>

        <table class="table table-striped table-bordered table-condensed">
            <thead>
            <tr>
                <th></th>
                <th>名称</th>
                <th>主机</th>
                <th>操作系统</th>
                <th>磁盘</th>
                <th>状态</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="vm in vms">
                <td><input type="checkbox" value="{{ vm.id }}"
                           ng-model="selected[vm.id]"/></td>
                <td>{{ vm.name }}</td>
                <td>{{ vm.host.host_name }}</td>
                <td>
                    <img ng-src="/static/images/os16/os_{{ vm.os_type |lowercase }}.png" alt="" class="img-size16"/>
                    {{ vm.os_type }}
                </td>
                <td>{{ vm.vdisk_set.length }}</td>
                <td>
                    <img ng-src="/static/images/vmstatus/{{ vm.status }}.png" alt="" class="img-size16"/>
                    {{ vm.status | vmstatus }}
                </td>
            </tr>
            </tbody>
        </table>
        <div class="pagination">
        <ul>
            <li ng-hide="should_hide()" ng-class="prev_class" ng-click="prev()"><a href="javascript:void(0);">上一页</a>
            </li>
            <li ng-repeat="i in [] | range:page_count()" ng-hide="should_hide()" ng-click="page(i)"
                ng-class="(i == current_page) && 'active'">
                <a href="javascript:void(0)">{{ i + 1}}</a>
            </li>
            <li ng-hide="should_hide()" ng-class="next_class" ng-click="next()"><a href="javascript:void(0);">下一页</a>
            </li>
        </ul>
    </div>
    </div>
    <div class="modal-footer">
        <a data-dismiss="modal" class="btn" ng-click="close()">关闭</a>
        <button type="submit" ng-disabled="!selected" class="btn btn-primary">保存</button>
    </div>
</form>

